package s0088;

import org.junit.Test;

public class MergeDemo {
	
	@Test
	public void testMerge(){
        int[] arr1 = {1,1,2,3,5,8,13,21,0,0,0,0,0,0,0,0};
        int[] arr2 = {1,2,5,7,11,13,17,19};
        Solution.merge(arr1,8,arr2,8);
        System.out.println(equals(arr1));

        int[] arr3 = {2,6,7,8,9,13,15,17,18,0,0,0,0,0,0,0,0,0};
        int[] arr4 = {1,2,5,7,11,15,17,23,25};
        Solution.merge(arr3,9,arr4,9);
        System.out.println(equals(arr3));

        int[] arr5 = {11,18,21,24,76,234,679,983,0,0,0,0};
        int[] arr6 = {45,56,56,57};
        Solution.merge(arr5,8,arr6,4);
        System.out.println(equals(arr5));
	}
	
	public static boolean equals(int[] arr){
        for (int i=0;i<arr .length-1;i++) {
            if (arr[i]>arr[i+1]) {
                return false;
            }
        }
        return true;
    }
}